package redisExampleCode.chapter1;

import redis.clients.jedis.Jedis;

import java.util.List;

public class DataConstruct {

    /**
     * 连接本地redis
     */
    static final Jedis conn = new Jedis("localhost", 6379);

    static final String baseKey = "DATA:CONSTRUCT:";


    public static void main(String[] args){
        try{
            Linked_list();





        }catch (Exception e){
            System.out.println(e);
        }finally {
            conn.flushDB();
        }

    }



    private static void Linked_list(){
        String key = baseKey + "linkedList";
        //将指定的值推送给列表的右端
        conn.rpush(key,"item");
        conn.rpush(key,"item2");
        conn.rpush(key,"item");
        //
        List<String> lrange = conn.lrange(key, 0, -1);
        System.out.println(lrange);
    }


}
